<?php
class QCampaignSku
{	
	public function __construct($p_strCountry)
	{
		$this->_country	= $p_strCountry;
		$this->_table	= $this->_country.'_campaign_skus';
	}
	

	public function getbyId($id)
	{
		$db	= Zend_Registry::get('db');
		$strQuery	= 'SELECT * FROM '. $this->_table . ' WHERE id=' . intval($id) . ';';
		$resultValue = $db->fetchAll($strQuery);
		$db->closeConnection();
		return $resultValue;
	}
	
	public function getAll()
	{
		$db	= Zend_Registry::get('db');
		$strQuery	= 'SELECT * FROM '. $this->_table . ' Order by sku;';
		$resultValue = $db->fetchAll($strQuery);
		$db->closeConnection();
		return $resultValue;
	}
	
	public function deletebyId($id)
	{
		$db	= Zend_Registry::get('db');
		$strQuery	= 'DELETE FROM '. $this->_table . ' WHERE id=' . intval($id) . ';';
		$db->execute($strQuery);
		$db->closeConnection();
	}
	
	public function insert($p_arrParams)
	{
		$db	= Zend_Registry::get('db');
		$resultValue =$db->insert($this->_table , $p_arrParams);
		$db->closeConnection();
		return $resultValue;
	}
	
	public function update($p_arrParams, $Id)
	{
		$db	= Zend_Registry::get('db');
		$resultValue = $db->update($this->_table , $p_arrParams, "id=" .intval($Id));
		$db->closeConnection();
		return $resultValue;
	}
}
?>